package game;

public class AmministratoreBuilder {
	private int width;
	private int height;
	private Cella[][] celle;

	public AmministratoreBuilder(int width, int height) {
		this.width = width;
		this.height = height;
		this.celle = new Cella[width][height];
	}

	public Amministratore build() {
		return new Amministratore(celle);
	}

	public AmministratoreBuilder stanza() {
		for (int x = 0; x < width; x++) {
			for (int y = 0; y < height; y++) {
				if((x==0)||(x==width-1)||(y==0)||(y==height-1)){
					if(y==height/2){
							if(x==0)
								celle[x][y]=Cella.ENTRATA;
							if(x==width-1)	
								celle[x][y]=Cella.EXIT;
					}
					else
					celle[x][y] = Cella.WALL;
				}
				else
					celle[x][y]=Cella.FLOOR;
				}
			}
		for(int i=0;i<10;i++)
		{
			int x;
			int y;
			
			do {
				x = (int)(Math.random() * width);
				y = (int)(Math.random() * height);
			} 
			while (!celle[x][y].isGround());
			celle[x][y]=Cella.POTION;
		}

		return this;
	}

	
}